package com.sunl.mall.ali.mq.model.transaction;

import com.sunl.mall.ali.mq.model.RocketMqMessageWrapper;
import com.sunl.mall.ali.mq.model.RocketMqMessageBody;
import com.sunl.mall.common.api.topic.MqTopic;

public class RocketMqTransactionMessageWrapper<T> extends RocketMqMessageWrapper<T> {
    /**
     * 默认事务消息第一次回查的最快时间，单位：秒（s）
     */
    public static int DEFAULT_CHECK_TIME_IN_SECONDS = 60;

    /**
     * 事务消息第一次回查的最快时间，单位：秒（s）
     */
    private int checkImmunityTimeInSeconds;

    public RocketMqTransactionMessageWrapper() {
    }

    public RocketMqTransactionMessageWrapper(MqTopic topic, RocketMqMessageBody<T> body, int checkImmunityTimeInSeconds) {
        super(topic, body);
        this.checkImmunityTimeInSeconds = checkImmunityTimeInSeconds;
    }

    public RocketMqTransactionMessageWrapper(MqTopic topic, RocketMqMessageBody<T> body) {
        this(topic, body, DEFAULT_CHECK_TIME_IN_SECONDS);
    }

    public int getCheckImmunityTimeInSeconds() {
        return checkImmunityTimeInSeconds;
    }
}
